<?php

class App_Methods_Data_ApplicationLink {
	
	public $label;
	public $description;
	public $url;
	
	public function __construct(ApplicationDataDefs $applicationDataDef) {
		$lang = Core_Core::getInstance()->getApp()->lang;
		if ($lang == 'en') {
			$this->label = $applicationDataDef->getLabelEn();
			$this->description = $applicationDataDef->getDescriptionEn();
		}
		else {
			$this->label = $applicationDataDef->getLabel();
			$this->description = $applicationDataDef->getDescription();
		}
		if ($applicationDataDef->getUserApplicationDatas()->getFirst() instanceof UserApplicationData) {
			$data = $applicationDataDef->getUserApplicationDatas()->getFirst();
			$this->url = $data->getValue();
		}
		else {
			$this->url = $applicationDataDef->getDefaultValue();
		}
	}
	
}